﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Script.Serialization;

namespace Paltop_v0._1.UI
{
    public partial class photoViewer : System.Web.UI.Page
    {
        public string pAddr="";
        protected void Page_Load(object sender, EventArgs e)
        {
            string temp=Request.QueryString["FILEID"];
            int fileId=11;
            if (temp != null)
            {
                fileId = Convert.ToInt32(temp);
            }
             
            int accountId=2;
            if (Session["ACCOUNTID"] != null)
            {
                accountId = Convert.ToInt32(Session["ACCOUNTID"].ToString());
            }
            Paltop_.Controllers.PhotoViewerController p = new Paltop_.Controllers.PhotoViewerController();
            var t=p.PhotoList(fileId, accountId);
            string addr="";
            List<string> addressList = new List<string>();
            foreach (var item in t)
            {
                addr = "/FileManager/" + accountId;
                if (item.ParentID != 0)
                {
                    var folder = item.Address;

                    addr = addr + "/" + folder;
                }
                else
                {
                    addr = addr + "/";
                }
                var title = item.Title;
                addr=addr+ title;
                addressList.Add(addr);
            }

            JavaScriptSerializer js = new JavaScriptSerializer();
             pAddr = js.Serialize(addressList);

           
        }
    }
}